package org.xxx.common.tool;

public class TestUtils {
    /**
     * 内容打印 行号+内容
     *
     * @param obj 打印对象
     */
    public static void print(Object obj) {
	StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();
	StackTraceElement e = stacktrace[2];
	String a = "\033[34m" + "    [" + "\033[0m";
	String b = "\033[34m" + "]   " + "\033[0m";
	String c = "\033[31m" + e.getLineNumber() + "\033[0m";
	String h = a + c + b;
	System.out.print(h);
	String s = null;
	if (JsonUtil.canSerialize(obj)) {
	    s = "\033[30m" + JsonUtil.format(JsonUtil.toJSON(obj)) + "\033[0m";
	} else {
	    s = obj.toString();
	}
	System.out.print(s);
    }
}
